package com.business.sys.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.business.sys.entity.DictionaryItem;
import com.business.sys.entity.DictionaryScopeItem;
import com.business.sys.mapper.DictionaryScopeItemMapper;
import com.business.sys.service.DictionaryScopeItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 范围字典项表:业务接口实现类
 *
 * @author chenjiehong
 * @date 2019-11-29 14:24:28
 * @since 1.0
 */
@Service
public class DictionaryScopeItemServiceImpl implements DictionaryScopeItemService {

    @Autowired
    private DictionaryScopeItemMapper dictionaryScopeItemMapper;

    @Override
    @Transactional(readOnly = true)
    public List<DictionaryScopeItem> query(int type) {
        EntityWrapper<DictionaryScopeItem> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("type_id",type).eq("state",1).orderBy("sort");
        List<DictionaryScopeItem> dictionaryScopeItemList = dictionaryScopeItemMapper.selectList(entityWrapper);
        return dictionaryScopeItemList;
    }

    @Override
    @Transactional(readOnly = true)
    public DictionaryScopeItem queryById(int id) {
        return dictionaryScopeItemMapper.selectById(id);
    }
}